export default function (context) {
  /* console.log(context) */
  context.userAgent = process.server ? context.req.headers['user-agent'] : navigator.userAgent
  context.store.commit('setOs', context.userAgent)
  if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(context.userAgent)) {
    context.store.commit('setPlatform', 'Mobile')
  } else {
    context.store.commit('setPlatform', 'PC')
  }
  /* let isPc =  true
  if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(context.userAgent)) {
    isPc = false
  }
  var reg = new RegExp('(' + context.route.name + ')', 'ig')
  if (context.route.fullPath === '/' && !isPc) {
    context.redirect('/mobile')
  } else if (context.route.fullPath.indexOf('mobile') === -1 && !isPc) {
    var to_path = context.route.fullPath.replace(reg, '$1mobile')
    context.redirect(to_path)
  } */
}